package com.hd.openapi.web.cotenollen;


import com.hd.openapi.common.Const;
import com.hd.openapi.common.ResponseResult;
import com.hd.openapi.entity.AdminUser;
import com.hd.openapi.entity.Menu;
import com.hd.openapi.servies.sermenudata;
import com.hd.openapi.servies.servies;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

@RestController
@RequestMapping("/cd")
public class menudata {
    @Autowired
    private sermenudata a;

    @RequestMapping("/cs")
    public ResponseResult cs(HttpSession session){
        AdminUser user = (AdminUser) session.getAttribute (Const.IS_LOGIN);
        if (user==null) {
            return ResponseResult.getFail ("先登录再说");
        }
        System.out.println (user.getId ()+"getid");
        List<Menu> getmenudata = a.getMenuByUid (user.getId ());
        ResponseResult success = ResponseResult.getSuccess (getmenudata);
        return success;
    }
}
